import React from 'react';
import { Radio, Row, Col } from 'antd';
import styles from './style.less';

// 员工特征
const Features = ({ data = [], hrCompanyVO = {}, onChange, featuresType }) => {
    if (data.length > 0 && !featuresType) {
        onChange(data[0].id);
    }
    return (
        <div className={styles.featuresWrap}>
            <div style={{ textAlign: 'right', marginBottom: 45 }}>
                {data.length > 0 && (
                    <Radio.Group
                        onChange={e => {
                            onChange(e.target.value);
                        }}
                        defaultValue={featuresType || data[0].id}
                        size="small"
                    >
                        {data.map(item => (
                            <Radio.Button key={item.id} value={item.id}>
                                {item.description}
                            </Radio.Button>
                        ))}
                    </Radio.Group>
                )}
            </div>
            <Row className={styles.row}>
                <Col span={12}>占比最高学历</Col>
                <Col span={12} className={styles.txtRight}>
                    {hrCompanyVO.percentageHighestEducation || '--'}
                </Col>
            </Row>
            <Row className={styles.row}>
                <Col span={12}>学历最高部门</Col>
                <Col span={12} className={styles.txtRight}>
                    {hrCompanyVO.highestEducationDepartmentName || '--'}
                </Col>
            </Row>
            <Row className={styles.row}>
                <Col span={12}>平均年龄</Col>
                <Col span={12} className={styles.txtRight}>
                    {hrCompanyVO.averageAge ? `${hrCompanyVO.averageAge}岁` : '--'}
                </Col>
            </Row>
            <Row className={styles.row}>
                <Col span={12}>平均司龄</Col>
                <Col span={12} className={styles.txtRight}>
                    {hrCompanyVO.averageDivisionAge ? `${hrCompanyVO.averageDivisionAge}年` : '--'}
                </Col>
            </Row>
        </div>
    );
};

export default Features;
